package com.example.javabighw.entity;

import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
public class User {
    private String id;
    private String username;
    private String password;
    private String giteeAccessToken;
    private String giteeRefreshToken;
    private String giteeNickname;
    private String giteeId;
    private String sessionKey;
    private String nickname;
    private String giteeAvatarUrl;
    private LocalDateTime lastTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getGiteeAccessToken() {
        return giteeAccessToken;
    }

    public void setGiteeAccessToken(String giteeAccessToken) {
        this.giteeAccessToken = giteeAccessToken;
    }

    public String getGiteeRefreshToken() {
        return giteeRefreshToken;
    }

    public void setGiteeRefreshToken(String giteeRefreshToken) {
        this.giteeRefreshToken = giteeRefreshToken;
    }

    public String getGiteeId() {
        return giteeId;
    }

    public void setGiteeId(String giteeId) {
        this.giteeId = giteeId;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public String getGiteeNickname() {
        return this.giteeNickname;
    }

    public void setGiteeNickname(String giteeNickname) {
        this.giteeNickname = giteeNickname;
    }

    public String getNickname() {
        return this.nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public LocalDateTime getLastTime() {
        return lastTime;
    }

    public void setLastTime(LocalDateTime lastTime) {
        this.lastTime = lastTime;
    }

    public String getLastTimeToString() {
        String format = "yyyy-MM-dd HH:mm:ss";
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
        return this.lastTime.format(dateTimeFormatter);
    }

    public void setLastTimeFromString(String str) {
        String format = "yyyy-MM-dd HH:mm:ss";
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(format);
        this.lastTime = LocalDateTime.parse(str, dateTimeFormatter);
    }

    public String getGiteeAvatarUrl() {
        return this.giteeAvatarUrl;
    }

    public void setGiteeAvatarUrl(String giteeAvatarUrl) {
        this.giteeAvatarUrl = giteeAvatarUrl;
    }
}
